function str=bytestohumanreadable(bytes)
if numel(bytes)~=1
    rand;
end
order=floor(log2(bytes)/10);
bytes=bytes/2.^(order*10);
switch order
    case 0
        orderstr='';
    case 1
        orderstr='K';
    case 2
        orderstr='M';
    case 3
        orderstr='G';
    case 4
        orderstr='T';
    case 5
        orderstr='E';
    otherwise
        bytes=bytes*2.^order;
        orderstr='';
end
str=sprintf('%.3g%sb',bytes,orderstr);